package edu.gatech.cs4400.spring2014.A8.control;

import edu.gatech.cs4400.spring2014.A8.model.DoctorData;
import edu.gatech.cs4400.spring2014.A8.view.ApplicationWindow;
import edu.gatech.cs4400.spring2014.A8.view.DoctorProfilePanel;

public class DoctorProfileController implements Controller {

	@Override
	public void run() {
		run(false);
	}
	
	public void run(boolean needsSave) {
		DoctorData data = new DoctorData();
		data.loadData();
		DoctorProfilePanel panel = new DoctorProfilePanel(data, needsSave);
		ApplicationWindow.addView(panel, "doctorprofile");
		ApplicationWindow.setView("doctorprofile");
		Waiter.waitFor(panel);
		
		if (panel.getFeedback() == DoctorProfilePanel.Feedback.SAVE) {
			data.saveData();
		}
	}

}
